const mixins = require('../../mixins/shop')
const common = require('../../mixins/common')
const app = getApp()
const options = {


  /**
   * 页面的初始数据
   */
  data: {
    visible:false,
    comments: [],
    imagesubject: [],
    isInput: true,
    page: 1,
    mask: true,
    maskClosable: true,
    voiceshow: false,
    audio_time: 0,
    is_complete_voice: !1,
    voiceshow: false,
    recording_status: "no_recording",
    deg: 0,
    progressWidth: 300,
    isIphoneX: app.globalData.isIphoneX,
    tabindex1:1000,
    currentConfig: {
      show: false,
      transition: true,
      zIndex: 99,
      locked: false,
      direction: 'bottom',
      arcRadius: 18,
      maxHeight: 600,
      minHeight: 600,
      opacity: 0.4
    },
    emojiChars: ["😀", "😁", "😂", "😃", "😄", "😅", "😆", "😉", "😊", "😋", "😎", "😍", "😘", "😗", "😙", "😚", "☺", "😇", "😐", "😑", "😶", "😏", "😣", "😥", "😮", "😯", "😪", "😫", "😴", "😌", "😛", "😜", "😝", "😒", "😓", "😔", "😕", "😲", "😷", "😖", "😞", "😟", "😤", "😢", "😭", "😦", "😧", "😨", "😬", "😰", "😱", "😳", "😵", "😡", "😠", "👦", "👧", "👨", "👩", "👴", "👵", "👶", "👱", "👮", "👲", "👳", "👷", "👸", "💂", "🎅", "👰", "👼", "💆", "💇", "🙍", "🙎", "🙅", "🙆", "💁", "🙋", "🙇", "🙌", "🙏", "👤", "👥", "🚶", "🏃", "👯", "💃", "👫", "👬", "👭", "💏", "💑", "👪", "💪", "👈", "👉", "☝", "👆", "👇", "✌", "✋", "👌", "👍", "👎", "✊", "👊", "👋", "👏", "👐", "✍", "👣", "👀", "👂", "👃", "👅", "👄", "💋", "👓", "👔", "👕", "👖", "👗", "👘", "👙", "👚", "👛", "👜", "👝", "🎒", "💼", "👞", "👟", "👠", "👡", "👢", "👑", "👒", "🎩", "🎓", "💄", "💅", "💍", "🌂"],
    showEmoji: !1,
    inputValue: "",
    picturePath: "",
    keyboardHeight: 400,
    isIOS: !1,
    textNum: 0,
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
   this.getOrderList();
  },

  handleCheckExpress:function(e){
    let exchange=e.currentTarget.dataset.exchange;
    this.setData({
      currentItem:exchange,
      visible:true,
    })
  },

  close: function () {
    this.data.maskClosable && (this.setData({
      showTextarea: !1,
      inputValue: "",
      picturePath: "",
      showEmoji: !1,
      voiceshow:false,
      title:'',
      parent:0,
    }))
  },

  

  onInputChange: function (t) {
    var a = t.detail.value;
    this.setData({
      inputValue: a
    });
  },
  onInputFocus: function (t) {
    console.log("comment-dialog => 输入框获取焦点"), console.log(t), this.data.showEmoji = !1;
    var a = wx.getSystemInfoSync(),
      e = parseInt(750 * t.detail.height / a.windowWidth);
    e > 0 && this.data.keyboardHeight != e && (this.data.keyboardHeight = e);
  },
  onEmojiClick: function () {
    this.data.showEmoji ? this.setData({
      showEmoji: !1
    }) : this.setData({
      showEmoji: !0,
      keyboardHeight: this.data.keyboardHeight
    });
  },

  stopTouch: function (t) {},
  onEmojiText: function (t) {
    var a = t.currentTarget.dataset.index;
    this.data.inputValue = this.data.inputValue + this.data.emojiChars[a], this.setData({
      inputValue: this.data.inputValue
    });
  },
  onImageChoose: function () {
    var t = this;
    wx.chooseImage({
      count: 1,
      sizeType: ["compressed"],
      success: function (a) {
        var e = a.tempFilePaths[0];
        console.log("comment-dialog => " + e), t.setData({
          picturePath: e
        });
      }
    });
  },

  /**
   * 关闭评论框
   */

  closeCommentary: function () {
    this.setData({
      showTextarea: false,
      voiceshow: false
    });
  },

  /**
   * 图片排序
   */

  imgPrev: function (t) {
    var e = t.currentTarget.dataset.index,
      a = this.data.imagesubject[e],
      i = this.data.imagesubject[e - 1];
    this.data.imagesubject[e] = i, this.data.imagesubject[e - 1] = a,
      this.setData({
        imagesubject: this.data.imagesubject
      });
  },
  imgNext: function (t) {
    var e = t.currentTarget.dataset.index,
      a = this.data.imagesubject[e],
      i = this.data.imagesubject[e + 1];
    this.data.imagesubject[e] = i, this.data.imagesubject[e + 1] = a,
      this.setData({
        imagesubject: this.data.imagesubject
      });
  },


  hideMask:function(){
    this.setData({
      currentItem:'',
      visible:false,
    })
  },

  handleExpress:function(e){
    let id=e.currentTarget.dataset.no;
    wx.navigateTo({
      url: '/pages/shop/express?id='+id,
    })
  },

  
  tapcomment: function (e) {
    var self = this;
    var id=e.currentTarget.id;
    if (this.data.user) {
      this.setData({
        id:id,
        showTextarea: true,
        focus: true,
      })
      setTimeout(function () {
        self.setData({
          focus: true
        });
      }, 100);
    } else {
      self.data.currentConfig.show = true;
      self.setData({
        currentConfig: self.data.currentConfig,
      })
    }
  },

  

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    let user = app.globalData.user
    if (!user) {
      user = '';
    }
    this.setData({
      user: user,
    })
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
}

mixins(options)
common(options)
Page(options)